<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<base href="${pageContext.request.contextPath}/">
<meta charset="utf-8" />
<title></title>
<meta name="description" content="overview & stats" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="static/css/others/bootstrap.min.css" rel="stylesheet" />
<link href="static/css/others/bootstrap-responsive.min.css" rel="stylesheet" />
<link rel="stylesheet" href="static/css/others/font-awesome.min.css" />
<!-- 下拉框 -->
<link rel="stylesheet" href="static/css/others/chosen.css" />

<link rel="stylesheet" href="static/css/others/ace.min.css" />
<link rel="stylesheet" href="static/css/others/ace-responsive.min.css" />
<link rel="stylesheet" href="static/css/others/ace-skins.min.css" />

<link rel="stylesheet" href="static/css/others/datepicker.css" />
<!-- 日期框 -->
<script type="text/javascript" src="static/js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="static/js/jquery.tips.js"></script>
</head>
<body>

	<form action="web/addbanner.do" name="Form" id="Form" method="post" enctype="multipart/form-data">
	<input name="id" value="${pd.id}" style="visibility: hidden;" >
		<!-- 新增框 -->
		<div id="zhongxin">
			<table id="table_report"
				class="table table-striped table-bordered table-hover">
				<tr>
					<td style="width: 100px; text-align: right; padding-top: 13px;">广告标题：</td>
					<td><input type="text" name="title" id="title"
						value="${pd.title}" placeholder="这里输入广告标题" title="广告标题" /></td>
				</tr>
				<tr>
					<td style="width: 100px; text-align: right; padding-top: 13px;">图片文件：</td>
					<td>
				 	<input type="file" name="file_upload" id="file_upload" multiple
						onchange="filechange(this)" title="附件url"  style="color: transparent;outline:none;" onchange="boolcheck()"></input>
						<input type="text" name="pic_url" id="pic_url" value="${pd.pic_url}" ></input>
					</td>
						
				</tr>
				<tr>
					<td style="width: 100px; text-align: right; padding-top: 13px;">广告链接：</td>
					<td><input type="text" placeholder="这里输入广告链接" id="link"
						name="link" value="${pd.link}" /></td>
				</tr>
				<tr>
					<td style="width: 100px; text-align: right; padding-top: 13px;">广告形式：</td>
					<td><select name="type" id="type">
							<option selected="selected" value="0">轮播广告</option>
							<option value="1">中框菜单</option>
							<option value="2">开屏广告</option>
					</select></td>
				</tr>
				<tr>
					<td style="width: 100px; text-align: right; padding-top: 13px;">跳转形式：</td>
					<td><select name="jump_type" id="jump_type">
								 <option value="0" >跳转到功能</option>
						        <option value="1">跳转到网页</option>
						        <option value="2">不跳转</option>
					</select></td>
				</tr>
				<tr>
					<td style="width: 100px; text-align: right; padding-top: 13px;">广告停留时间：</td>
					<td><input type="text" id="disp_time" name="disp_time"
						value="${pd.disp_time}" /><strong>S</strong></td>
				</tr>
				<tr>
					<td style="width: 100px; text-align: right; padding-top: 13px;">投放状态：</td>
					<td>
						<select name="status" id="status">
								<option value="1" select:seleced;>启用</option>
								<option value="0">禁用</option>
						</select>
					</td>
				</tr>
				<tr>
					<td style="width: 100px; text-align: right; padding-top: 13px;">备注:</td>
					<td><input type="text" name="memo" id="memo"
						value="${pd.memo}" placeholder="备注" title="备注" /></td>
				</tr>
					<tr>
						<td style="text-align: center;" colspan="10"><a
							class="btn btn-mini btn-primary" onclick="save();">发布</a> <a
							class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
						</td>
					</tr>
				</table>
			</div>

			<div id="zhongxin2" class="center" style="display: none">
				<br />
				<br />
				<br />
				<br />
				<br />
				<img src="static/images/jiazai.gif" /><br />
				<h4 class="lighter block green">提交中...</h4>
			</div>
			<input type="hidden" id="pdtype" value="${pd.type}" />
		<input type="hidden" id="pdjump" value="${pd.jump_type}" />
		<input type="hidden" id="pdstatus" value="${pd.status}" />
		<input type="hidden" id="id" name="id"  value="${pd.id}" />
		 <input type="hidden" name="boolcheck" id="boolcheck" value="0"></input>
	</form>

	<!-- 引入 -->
	<script type="text/javascript">
	//sel获取编辑值
		
		var oType=document.getElementById('type'); 
		var oJump=document.getElementById('jump_type');
		var oStatus=document.getElementById('status');
		var oPdtype=document.getElementById('pdtype'); 
		var oPdjump=document.getElementById('pdjump');
	 	
		
		for(var i=0;i<3;i++){
			oType.options[oPdtype.value].selected=true;
			oJump.options[oPdjump.value].selected=true;
			oStatus.options[oPdstatus.value].selected=true;
		}
		
	
	
	
		window.jQuery
				|| document
						.write("
						<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");
	</script>
						<script src="static/js/bootstrap.min.js"></script>
						<script src="static/js/ace-elements.min.js"></script>
						<script src="static/js/ace.min.js"></script>
						<script type="text/javascript" src="static/js/chosen.jquery.min.js"></script>
					<!-- 下拉框 --> <script type="text/javascript"
							src="static/js/bootstrap-datepicker.min.js"></script> <!-- 日期框 -->
						<script type="text/javascript">
						var newurl;
						var beforeurl;
						var boolcheck=0;
						var oBoolcheck=document.getElementById('boolcheck'); 				
						
						
						
						
						
		$(top.hangge());
		$(function() {
			//单选框
			$(".chzn-select").chosen();
			$(".chzn-select-deselect").chosen({
				allow_single_deselect : true
			});

			//日期框
			$('.date-picker').datepicker();

		});
		
		
		/* 	兼容 */
		var isIE = /msie/i.test(navigator.userAgent) && !window.opera; 	
		/* 		控制文件上传大小 */
		
		function filechange(target){
			var url = document.getElementById('pic_url');
			 newurl=target.value;
			beforeurl=url.value; 
			url.value=target.value;
			   var fileSize = 0;   
			     fileSize = target.files[0].size;  
			   /*   alert("daxiao"+fileSize); */
			     var maxSize=1024*1024*25;
			     if(fileSize>maxSize){
			    	  alert("文件超出规定大小，请重新选择!"); 
			    	   target.value="";  
			           return  
			     }
			   
			     
		}	
		
		
		//保存
		function save() {
 			if(newurl!=beforeurl) {
 				boolcheck=1; 
 			}
 			if(boolcheck==1) oBoolcheck.value="1";
			if ($("#pic_url").val() == "") {
				$("#pic_url").tips({
					side : 3,
					msg : '请输入图片链接',
					bg : '#AE81FF',
					time : 2
				});
				$("#pic_url").focus();
				return false;
			}
			
			if ($("#type").val() == "") {
				$("#type").tips({
					side : 3,
					msg : '请输入投放形式',
					bg : '#AE81FF',
					time : 2
				});
				$("#type").focus();
				return false;
			}
			
			
			if ($("#jump_type").val() == "") {
				$("#jump_type").tips({
					side : 3,
					msg : '请输入跳转形式',
					bg : '#AE81FF',
					time : 2
				});
				$("#jump_type").focus();
				return false;
			}
			
			
			if ($("#status").val() == "") {
				$("#status").tips({
					side : 3,
					msg : '请输入投放状态',
					bg : '#AE81FF',
					time : 2
				});
				$("#status ").focus();
				return false;
			}
/* 			if (!isNaN($("#disp_time").val())) {
				$("#disp_time").tips({
					side : 3,
					msg : '请输入数字'
					bg : '#AE81FF',
					time : 2
				});
				$("#disp_time ").focus();
				return false;
			} */

			
			$("#Form").submit();
			$("#zhongxin").hide();
			$("#zhongxin2").show();
		}
		
		
	</script>
</body>
</html>